﻿@model GameSchoolApplication.Models.StudentAssignmentPoints

@{
    ViewBag.Title = "Verkefni";
    Layout = "~/Views/Shared/_StudentLayout.cshtml";
}

<h2>@Model.Assignment.Title</h2>
<p>@Html.Raw(Model.Assignment.Description.Replace("\n", "<br/>"))</p>


<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@if (Model.Id != 0)
{ 
    <p>Verkefninu hefur verið skilað</p>
}
else if(DateTime.Now > Model.LevelEntry.StartedAt.AddDays(Model.Assignment.Days))
{
    <p>Því miður, skilatíminn er útrunninn.</p>
}
else
{
    using (Html.BeginForm("HandIn", "Assignment", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend></legend>
        @Html.HiddenFor(model => model.AssignmentId)

        <p>Tími eftir í skil: @ViewBag.TimeLeft.Days dagar, @ViewBag.TimeLeft.Hours tímar, @ViewBag.TimeLeft.Minutes mínútur</p>

        <div class="editor-label">
            <label for="fileBase">Lausn verkefnis</label>
        </div>
        <div class="editor-field">
            <input type="file" name="fileBase" id="fileBase"/>
        </div>
        <p>
            <input type="submit" value="Staðfesta" />
        </p>
    </fieldset>
    }
}
<div>
    @Html.ActionLink("Til baka í lista", "Active", "Level", new { gameId = Model.Assignment.Level.GameId }, new { })
</div>
